<template>
  <div class="footer border-top">
    <div class="flex flex-pack-justify  flex-align-center">
      <router-link to="/home" class="flex-1" :class="{cur: curPage == 'home'}">
        <i class="icon icon-home"></i>
        <p>首页</p>
      </router-link>
      <router-link to="/category"  class="flex-1" :class="{cur: curPage == 'category'}">
        <i class="icon icon-category"></i>
        <p>找特产</p>
      </router-link>
      <router-link  to="/purchase/list" class="flex-1" :class="{cur: curPage == 'purchase'}">
        <i class="icon icon-purchase" :class="{point: hasPurchase}"></i>
        <p>采购单</p>
      </router-link>
      <router-link  to="/me" class="flex-1" :class="{cur: curPage == 'me'}" >
        <i class="icon icon-mine"></i>
        <p>我</p>
      </router-link>
    </div>
  </div>
</template>

<script>
  import star from 'components/star/star';
  import {pruchaseNum} from '../../services/api';

  export default {
    props: {
        curPage: {
          default: 'home'
        }
    },
    data() {
      return {
        title: '熊猫联采',
        hasPurchase: false //是否有采购单
      }
    },
    methods: {
      //是否有采购单数据
      pruchaseNum(){
        pruchaseNum().then(data=>{
          if(data.returnCode == '000000'){
             if(data.result.pruchaseNum > 0){
               this.hasPurchase = true;
             }
          }
        })
      }
    },
    created() {
       this.pruchaseNum();
    },
    components: {

    }
  };
</script>

<style lang="less" scoped>
  @import "./foot.less";
</style>
